package com.tron.dobest.ymldata;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TronMetadataTestController {

    private TronMetadata tronMetadata;

    //-----------------------获取容器中Bean的属性-------------------------------

    @Value("#{tronMetadata.tronFriend1.name}")
    private String value2;

    @Value("#{tronMetadata.tronMap1.get('key1')}")
    private String value3;

    @Value("#{tronMetadata.tronFriends1.get(0).age}")
    private String value4;

    public TronMetadataTestController(TronMetadata tronMetadata) {
        this.tronMetadata = tronMetadata;
    }

    @GetMapping("/getMetadata")
    public Object getMetadata() {
        return tronMetadata;
    }

    @GetMapping("/useMetadata")
    public Object useMetadata() {
        return  value2 + " " +value3 + " "+value4;
    }

}
